package com.bwie.remote.fegin;

import com.bwie.common.exception.BusinessException;
import com.bwie.common.pojo.dto.UserDto;
import com.bwie.common.pojo.po.UserPo;
import com.bwie.common.result.Result;
import com.bwie.remote.AuthRemoteService;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class AuthFallbackFactoryService implements FallbackFactory<AuthRemoteService> {
    @Override
    public AuthRemoteService create(Throwable cause) {
        return new AuthRemoteService() {
            @Override
            public UserPo login(UserDto userDto) {
                throw new BusinessException(Result.error("网络异常"));
            }
        };
    }
}
